# -*- coding: utf-8 -*-

'''eof
name:账密验证变更
code:MG_Account_Change
tableName:
columnName:
groups:数据质量
dependencies:YSDDH_BTM
type:常用指标
datasourceType:在线指标
description:
eof'''


import sys
import pandas as pd
import json
import datetime

reload(sys)
sys.setdefaultencoding('utf-8')


def format_data():
    try:
        indent = json.loads(YSDDH_BTM[0]['data'])
        return indent if isinstance(indent, dict) and len(indent) > 0 else [{}]
    except:
        return [{}]


def MG_Account_Change():
    null_type_list = ['', None, 'null', 'Null', 'NULL', '/', ' ']
    try:
        btm = format_data()
        if btm.get("status") not in null_type_list and btm.get("message") not in null_type_list:
            if btm.get("status") == 500 and btm.get("message") == u'账号密码错误':
                return 1
            else:
                return 0
        else:
            return u'缺失值'
    except:
        return u'缺失值'


result = MG_Account_Change()